  <script type="text/javascript">
  $(function(){
 	 $.post("applicationBatch/getfiles",getApplicationBatchInfo,"json");
 	//$("#fileField").attr("disabled",true);
 });
  //检查复选框-------------------------------------------------------------------
 $("#fileField").click(function(){
	var flag=true;
	var val=$('input[name="ids"]:checked').length;
	$("input[name='ids']:checked").each(function(n,item){
 		parm=$(this).val();
 	});	
      if(val<1){
     	 alertMsg.info('请选择要导入的批次号！');
     	flag=false;
      }else if(val!=0){
    	  $.ajax({
  		    type: "POST",
  		    url:"applicationBatch/getServices",
  		    data:{"applyBatchNo":parm},
  		    async : false,
  		    dataType:"json",
  		    success: function(json){
  			if(json.statusCode==DWZ.statusCode.error){
  				navTabAjaxDone(json);
  				flag=false;
  			}
  		 },	
  		}); 
      }
     return flag;
 });
 
	
  
//导入申请文件-----------------------------------------------------------------------
 function emportInfo(form){
  //alert($(form).attr("action"));
	 $.ajax({
		type: $(form).method || 'POST',
		url:$(form).attr("action"),
		data:$(form).serialize(),
		dataType:"json",
		success: function(json){
			if(json.statusCode==DWZ.statusCode.error){
				navTabAjaxDone(json)
			}else{
				printViewPageAjaxDone(json);
				$(json).each(function(n,item){				
					if(item.exceptionBatch==0){
						//navTab.reload("applicationBatch/batch");
						alertMsg.correct('文件导入成功！');
						
					}else{
						 var exceptionBatches = item.exceptionBatch;
						 getApplicationBatchRefresh(exceptionBatches);
						
					}
				})
			}
			
		}	
	}); 
return false; 
};
//导出信息-------------------------------------------------------------------
  function exportInfo() {  
	 var length;
	 var str="";
	 $("input[name='ids']:checked").each(function(n,item){
		 if($(item).attr("param")==undefined ){
			 alertMsg.error("请正确选择要导出的错误文件!");
			 return false;
		 }
		 str+=$(this).attr("value")+",";
	 })
      if(str==""){
    	 alertMsg.error('请选择要导出的错误批次号文件！');
         return false;
     } 
     str=str.substring(0,str.length-1);
      var appBatchNo_json = {"applyBatchNo":str};     
		$.ajax({
			type: 'POST',
			url:'applicationBatch/export',
			data:appBatchNo_json,
			dataType:"json",
			cache:false,
			success: function(json){
						//重新加载该页面
						paths = json.st
						
					for(var i=0;i<paths.length;i++){
						window.location.href = paths[i]

					}
						navTab.reload("applicationBatch/batch");
					
				}
			}); 
	return false;
 };  

//去收费页面
 function chargeBatch(){
	var parm=$('input[name="ids"]:checked').val();
 	if($("input[name='ids']:checked").length < 1){
 		 alertMsg.warn("您未选择数据！")
 		 return false;
 	}else{
  	  $.ajax({
		    type: "POST",
		    url:"applicationBatch/getServices",
		    data:{"applyBatchNo":parm},
		    async : false,
		    dataType:"json",
		    success: function(json){
			if(json.statusCode==DWZ.statusCode.error){
				var options = new Object();
			 	options.width=550;
				options.height=270;
			 	options.param=parm;
			 	$.pdialog.open("applicationBatch/goCharge","infos", "收费",options);
			}else{
				alertMsg.error('该批次号已收费！');
			}
		 },	
		}); 
    }
 	/* var parm;
 	var options = new Object();
 	options.width=550;
	options.height=270;
 	$("input[name='ids']:checked").each(function(n,item){
 		parm=$(this).val();
 	});	
 	options.param=parm;
 	$.pdialog.open("applicationBatch/goCharge","infos", "收费",options); */
 	return false;
 }
</script> 
<form id="pagerForm" method="post" action="applicationBatch/paging">
	<input type="hidden" name="pageNum" value="" /> 
	<input type="hidden" name="numPerPage" value="" />
	<!-- <input type="hidden" name="pageCount" value="" /> -->
</form>
<form  action="applicationBatch/emport" onsubmit="return emportInfo(this);" method="post">
	<div class="pageContent">
		<div class="panelBar">
			<ul class="toolBar">
				<li><a class="add" href="applicationBatch/goFileUpload" target="dialog" rel="fileUploadIndex" title="上传文件" wh="small"><span>上传文件</span></a></li>
				<li><a class="delete" href="applicationBatch/goExportTemplate" target="dialog" rel="fileUploadIndex" title="生成空白模板" wh="small"><span>生成空白模板</span></a></li>
			    <!-- <li><a class="edit"  onclick="return charge();"><span>收费</span></a></li> -->
			</ul>
		</div>
		<div id="ByAppBatch">
			<table  id="tableExcel" class="table" width="100%" layoutH="286">
				<thead>
					<tr align="center">
						<!-- <th width="2%"><input type="checkbox" name="" group="ids" class="checkboxCtrl"></th> -->
						<th width="3%">选择</th>
						<th  width="77%" class="asc">批次号</th>
						<th width="20%">状态</th>
					</tr>
				</thead>
				<tbody id="tbodyByBatchApplication">
				</tbody>
			</table>
			</div>
			<!-- <div class="panelBar" style=text-align:center>
				<div class="pages">
					<span>显示</span> 
					<select name="numPerPage"
						onchange="navTabPageBreak({numPerPage:this.value})">
						<option value="20">20</option>
						<option value="30">30</option>
						<option value="50">50</option>
					</select> <span id="totalCount"></span>
				</div>
	
					<div id="pagination" class="pagination1">
	
					</div>
			</div> -->
		<div class="panelBar">
			<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'tbodyByBatchApplication',getApplicationBatchInfo)">
					<option value="20">20</option>
					<option value="50">50</option>
					<option value="100">100</option>
					<option value="200">200</option>
				</select>
				<span id="totalCountByBatchApplication">条，共${totalCount}条</span>
			</div>
	
			<div callback='getApplicationBatchInfo' id="paginationByBatchApplication" rel="tbodyByBatchApplication" class="pagination" targetType="navTab" totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

		</div>
	</div>

	 <div class="formBar">
		<ul> 
		     <li>
				<div class="buttonActive" >
					<div class="buttonContent" ><button type="button" onclick="return chargeBatch();">收费</button></div>	
				</div>
			</li>
			<li>
				<div class="buttonActive" >
					<div class="buttonContent" ><button type="submit"  id="fileField" >导入</button></div>	
				</div>
			</li>
			<li>
				<div class="buttonActive" >
					<div class="buttonContent" ><button type="button" onclick="return exportInfo()">导出</button></div>	
				</div>
			</li>
			<li>
				<div class="buttonActive" >
					<div class="buttonContent" ><button type="button" class="close" >关闭</button></div>	
				</div>
			</li>
		</ul>
	</div> 
</form>